//
//  YKBaseViewController.m
//  yuke
//
//  Created by Dejun Liu on 15/1/5.
//  Copyright (c) 2015年 juwan. All rights reserved.
//

#import "YKBaseViewController.h"

@interface YKBaseViewController ()

@end

@implementation YKBaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self showYKNavigationBar];
    [self showHomeNavigationBar];
    if ([self respondsToSelector:@selector(edgesForExtendedLayout)]) {
        self.edgesForExtendedLayout = UIRectEdgeNone;
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)showYKNavigationBar
{
    if (IOS_7_OR_LATER) {
        NSDictionary *titleAttributes = @{
                                          NSFontAttributeName:[UIFont boldSystemFontOfSize:18],
                                          NSForegroundColorAttributeName:[UIColor colorWithHex:0xffffff]
                                          };
        
        self.navigationController.navigationBar.barTintColor = UIColorFromRGB(74, 189, 204);
        self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
        self.navigationController.navigationBar.titleTextAttributes = titleAttributes;
    }
}

#pragma mark - 主页navi -

- (void)showHomeNavigationBar
{
    if (IOS_7_OR_LATER) {
        self.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"home_title"]];
        self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"search_off"] style:UIBarButtonItemStylePlain target:self action:@selector(searchButtonClick)];
    }
}

- (void)hideHomeNavigationBar
{
    if (IOS_7_OR_LATER) {
        self.navigationItem.titleView = nil;
        self.navigationItem.rightBarButtonItem = nil;
    }
}

- (void)searchButtonClick
{
    
}

#pragma mark - 目的地navi -

- (void)setDestiNavigationBar
{
    if (IOS_7_OR_LATER) {

    }
}

@end
